package cn.ltgodm.moj.codesandbox.impl;


import cn.ltgodm.moj.codesandbox.CodeSandbox;
import cn.ltgodm.moj.codesandbox.model.ExecuteCodeRequest;
import cn.ltgodm.moj.codesandbox.model.ExecuteCodeResponse;
import cn.ltgodm.moj.model.enums.QuestionJudgeInfomessageEnum;
import cn.ltgodm.moj.model.enums.QuestionSubmitStatusEnum;
import cn.ltgodm.moj.model.sandbox.JudgeInfo;

import java.util.Arrays;

/**
 * 实例代码沙箱
 */
public class ExampleCodeSandbox implements CodeSandbox {
    @Override
    public ExecuteCodeResponse executeCode(ExecuteCodeRequest executeCodeRequest) {
        System.out.println("测试用例代码沙箱");
        JudgeInfo judgeInfo = new JudgeInfo();
        judgeInfo.setMessage(QuestionJudgeInfomessageEnum.ACCEPTED.getText());
        judgeInfo.setMemory(100L);
        judgeInfo.setTime(100L);
        ExecuteCodeResponse executeCodeResponse = ExecuteCodeResponse.builder()
                .message("测试代码沙箱")
                .status(QuestionSubmitStatusEnum.SUCCEED.getValue())
                .outputList(Arrays.asList("1 2", "3 4"))
                .judgeInfo(judgeInfo)
                .build();
        return executeCodeResponse;
    }
}
